package hibernate

class Role {
    static hasMany = [robots:Robot]
    static belongsTo = Robot //支持级联删除

    String name

    static mapping = {
        table "role"

        id column:"ID"
        version column:"VERSION"

        name column:"NAME"

        robots column: "ROLE_ID", joinTable: "robot_role" //robots joinTable: [name:"robot_role", key:"ROLE_ID", column: "ROBOT_ID"]
    }

    static constraints = {
    }
}
